package com.shiyun.cli.pattern;

public class Client {
    public static void main(String[] args) {
        //创建设备
        Device tv = new Device("电视机");
        Device ad = new Device("空调");
        //命令绑定设备
        TurnOffCommand turnOff = new TurnOffCommand(tv);
        TurnOnCommand turnOn = new TurnOnCommand(tv);
        //创建客户端
        RemoteControl remoteControl = new RemoteControl();
        remoteControl.setCommand(turnOn);
        remoteControl.pressButton();
        remoteControl.setCommand(turnOff);
        remoteControl.pressButton();
    }

}
